{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['bert_second_level_pred.csv',\n",
       " 'One-HotAddNN-Ensemble-L0.875625-NB50000.csv',\n",
       " 'predsAddNN-Ensemble-L0.877274-NB50000.csv',\n",
       " 'predsAddNN-Ensemble-L0.877469-NB50000.csv',\n",
       " 'pseudo_first_level.csv',\n",
       " 'test_preds.csv']"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "os.listdir(\"../data/high_ground/\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "best_nns = pd.read_csv(\"../data/high_ground/fine_tuned_nns.csv\")\n",
    "best_berts = pd.read_csv(\"../data/high_ground/fine_tuned_bert.csv\")\n",
    "\n",
    "final_answers = best_nns * 0.79 + best_berts * 0.21 # Try to keep the correlations well-distributed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "ids = pd.read_csv(\"../data/dataset/test.csv\")\n",
    "sub = pd.DataFrame({\"Id\": ids['id'].values, \"Category\": final_answers.idxmax(axis=1)})\n",
    "sub.to_csv(\"../data/high_ground/final_answer.csv\", index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
